// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) 
// Source File Name:   Host.java

package org.quickserver.net.client;

import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.Date;

public class Host
{

    public Host()
    {
        status = 'U';
        timeout = 10000;
    }

    public String toString()
    {
        StringBuilder sb = new StringBuilder();
        if(getName() != null)
            sb.append(getName());
        sb.append("[");
        sb.append("Host:");
        sb.append(getInetAddress());
        sb.append("; Status:");
        sb.append(getStatus());
        sb.append("]");
        return sb.toString();
    }

    public Host(String ip)
        throws UnknownHostException
    {
        status = 'U';
        timeout = 10000;
        setInetAddress(ip);
    }

    public Host(InetAddress inetAddress)
    {
        status = 'U';
        timeout = 10000;
        setInetAddress(inetAddress);
    }

    public InetAddress getInetAddress()
    {
        return inetAddress;
    }

    public void setInetAddress(String ip)
        throws UnknownHostException
    {
        inetAddress = InetAddress.getByName(ip);
    }

    public void setInetAddress(InetAddress inetAddress)
    {
        this.inetAddress = inetAddress;
    }

    public char getStatus()
    {
        return status;
    }

    public void setStatus(char status)
    {
        this.status = status;
    }

    public Date getLastCheckedOn()
    {
        return lastCheckedOn;
    }

    public void setLastCheckedOn(Date lastCheckedOn)
    {
        this.lastCheckedOn = lastCheckedOn;
    }

    public Date getNextCheckOn()
    {
        return nextCheckOn;
    }

    public void setNextCheckOn(Date nextCheckOn)
    {
        this.nextCheckOn = nextCheckOn;
    }

    public int getTimeout()
    {
        return timeout;
    }

    public void setTimeout(int timeout)
    {
        this.timeout = timeout;
    }

    public String getName()
    {
        return name;
    }

    public void setName(String name)
    {
        this.name = name;
    }

    public static final char UNKNOWN = 85;
    public static final char ACTIVE = 65;
    public static final char DOWN = 68;
    public static final char ERROR = 69;
    public static final char MAINTENANCE = 77;
    private InetAddress inetAddress;
    private char status;
    private int timeout;
    private Date lastCheckedOn;
    private Date nextCheckOn;
    private String name;
}
